package com.xiaocikuai.smallchunks.config;

import com.yl.jms.sdk.JtExpressApi;
import com.yl.jms.sdk.auth.ClientConfiguration;
import com.yl.jms.sdk.client.JtExpressApiOperator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class JTExpressConfig {

    @Value("683615311718531131")
    public String apiAccount;

    /**
     * privateKey : 为账号通过平台认证后自动分配,由平台提供
     */
    @Value("cc71c7871eab426d8ae0369ef0d36e21")
    public String privateKey;

    /**
     * customerCode : 协议客户账号
     */
    @Value("J00866985380")
    public String customerCode;

    /**
     * orderPassword : 协议客户密码
     */
    @Value("Xiaocikuai666")
    public String orderPassword;

    @Bean
    public JtExpressApi jtExpressApi(){
        ClientConfiguration clientConfiguration = new ClientConfiguration(apiAccount,privateKey);
        //当调用postByCustom方法时需要customerCode和orderPassword
        clientConfiguration.setCustomerCode(customerCode);
        clientConfiguration.setCustomerPwd(orderPassword);
        JtExpressApi jtExpressApi = new JtExpressApiOperator(clientConfiguration);
        return jtExpressApi;
    }
}
